package com.gzcsqic.excelapp.controller;

import cn.hutool.core.io.resource.NoResourceException;
import cn.hutool.core.lang.Assert;
import cn.hutool.script.ScriptUtil;
import cn.hutool.setting.dialect.Props;
import com.gzcsqic.excelapp.common.R;
import com.gzcsqic.excelapp.service.SystemService;
import com.gzcsqic.excelapp.utils.OsUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@RequestMapping("sys")
@RestController
@CrossOrigin
public class SystemController {

    @Resource
    private SystemService systemService;

    @GetMapping("getPrinter")
    public R getPrinter(){
        return R.success(systemService.getPrinters());
    }

    @GetMapping("getEmployee")
    public R getEmployee(){
        List<Map<String, String>> employees = systemService.getEmployees();
        return R.success(employees);
    }

    @GetMapping("getSiParam")
    public R getSiParam(){
        List<Map<String, String>> siParams = systemService.getSiParams();
        return R.success(siParams);
    }

    @GetMapping("getGrParam")
    public R getGrParam(){
        List<Map<String, String>> grParams = systemService.getGrParams();
        return R.success(grParams);
    }

    @GetMapping("getTestParam")
    public R getTestParam(){
        List<Map<String, String>> testParams = systemService.getTestParams();
        return R.success(testParams);
    }

    @GetMapping("shutdown")
    public void shutdown() throws InterruptedException, IOException {
        systemService.shutdown();
    }
}
